TException
CSharpTest.Net
SafeLock<TException> Structure
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Synchronization Namespace : SafeLock<TException> Structure

Glossary Item Box

Exactly as SafeLock except that <T> specifies the exception type to throw. Used to acquire a lock(object) with a timeout, either specified or the default of 2 minutes.

Syntax

Visual Basic (Declaration) 
Public Structure SafeLock(Of TException As {New, Exception}) 
   Inherits System.ValueType
C# 
public struct SafeLock<TException> : System.ValueType 
where TException: new(), Exception

Type Parameters

TException

Example

Library/Library.Test/LockingTests/TestLockingStructs.cs

C#Copy Code
object instance = new object();
using (new SafeLock<InvalidOperationException>(instance))
{ }
VB.NETCopy Code
Dim instance As New Object()
Using New SafeLock(Of InvalidOperationException)(instance)
End Using

Inheritance Hierarchy

System.Object
   System.ValueType
      CSharpTest.Net.Synchronization.SafeLock<TException>

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys